//
//  GDFiterCellModel.m
//  GridGovernance
//
//  Created by 吴欧 on 2017/11/22.
//  Copyright © 2017年 Bitvalue. All rights reserved.
//

#import "GDFiterCellModel.h"
#import "MCTableBaseMetadata.h"

//#import "GDTypeSelectCell.h"
//#import "GDInputUnitCell.h"
//#import "GDMapLocSelectCell.h"
//#import "GDTextViewCell.h"
//#import "GDAddPhotoCell.h"
//#import "GDTimeSelectCell.h"
//#import "GDRadioSelectCell.h"

/*
 
 GDFiterCellTypeSelect_PK = 0,
 GDFiterCellTypeSelect_TEXT = 1,
 GDFiterCellTypeSelect_TEXTView = 2,
 GDFiterCellTypeSelect_MAP = 3,
 GDFiterCellTypeSelect_ADDPHOTO = 4,

 */

#import "HEGoodDetailsTitleCell.h"
#import "UIGoodsDetailsRefuseCell.h"
#import "HEGoodDetailsSpecCell.h"
#import "HECommentsHeaderCell.h"
#import "HEGoodsDetailsCommentsCell.h"
#import "HEGoodsDetailsHtmlCell.h"
#import "HEGoodsDetailsNoCommentsCell.h"
#import "HEGoodsDetailsCompanyCell.h"
#import "HEGoodsDetailsAreaCell.h"
#import "HEGoodsDetailsRecomCell.h"

@implementation GDFiterCellModel

- (instancetype)init {
    if (self = [super init]) {
        
        // 设置图片cell默认属性
        _maxImgNum = 9;
        _ImgHeight = 200;
        
        // textField 
        _enable = YES;
        
        _lineNum = 3;
        _spacing = 10;
        _photoMangeType = GDCellPhotoManagerSelectedTypePhoto;
        _leftTitleColor = CNavLightBlackColor;
        _contentColor = CNavLightBlackColor;

        _registType = GDFiterCellRegisterByClass;
        _cellDisplayType = GDCellDisplayShow;
        
        _leftFont = DYFont(17);
        _contentFont = DYFont(17);
    }
    return self;
}

//- (CGFloat)cellHeight {
//    
//    if (!_cellHeight) {
//        _cellHeight
//    }
//    return _cellHeight;
//}

- (Class)cellKlass {
    
    if (!_cellKlass) {
        _cellKlass = [self getCellClass];
    }
    
    return _cellKlass;
}

- (NSString *)cellId {
    if (!_cellId) {
        if (_cellKlass) {
            // 设置默认id
            _cellId = NSStringFromClass(_cellKlass);
        }
    }
    return _cellId;
}
 
- (Class)getCellClass { 
    switch (_cellType) {
        case GDFiterCellTypeGoodsDetailsTitle:
            return [HEGoodDetailsTitleCell class];
            break;
        case GDFiterCellTypeGoodsDetailsRefuse:
            return [UIGoodsDetailsRefuseCell class];
            break;

        case GDFiterCellTypeGoodsDetailsSku:
            return [HEGoodDetailsSpecCell class];
            break;

        case GDFiterCellTypeGoodsDetailsCommentHeader:
            return [HECommentsHeaderCell class];
            break;
        case GDFiterCellTypeGoodsDetailsComment:
            return [HEGoodsDetailsCommentsCell class];
            break;
        case GDFiterCellTypeGoodsDetailsHtml:
            return [HEGoodsDetailsHtmlCell class];
        break;
        case GDFiterCellTypeGoodsDetailsNoComments:
            return [HEGoodsDetailsNoCommentsCell class];
        break;
        case GDFiterCellTypeGoodsDetailsCompany:
            return  [HEGoodsDetailsCompanyCell class];
        break;
        case GDFiterCellTypeGoodsDetailsArea:
            return [HEGoodsDetailsAreaCell class];
        break;
        case GDFiterCellTypeGoodsDetailsRecom:
            return  [HEGoodsDetailsRecomCell class];
        break;
        default:
            break;
    }
    
    return nil;
}

- (NSString *)imagesKey {
    if (!_imagesKey) {
        _imagesKey = @"gd_imgs";
    }
    return _imagesKey;
}

- (NSString *)photoUrlsKey {
    if (!_photoUrlsKey) {
        _photoUrlsKey = @"gd_imgUrls";
    }
    return _photoUrlsKey;
}

- (NSString *)localImagesKey {
    if (!_localImagesKey) {
        _localImagesKey = @"gd_locImgs";
    }
    return _localImagesKey;
}

- (CGFloat)getCollectionHeight:(UICollectionView *)collectionView {
    if (!_cellHeight) {
        _cellHeight = collectionView.collectionViewLayout.collectionViewContentSize.height;
    }
    return _cellHeight;
}

@end
